<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>树组件</title>

	</head>
	<script src="js/global.js" type="text/javascript" charset="utf-8"></script>

	<body>
		<div id="test1"></div>

		<script>
			layui.use(['tree', 'laydate'], function() {
				var tree = layui.tree;
				var $ = layui.$;
				$.post(globalData.server + "GetSysRightsJsonLayUI", {
						roleNames: ['研发专员', '管理员'], //正常应该是登录成功时
						token: globalData.myToken
					}, function(res) {
						//渲染
						var inst1 = tree.render({
							edit: ['add', 'update', 'del'],
							showCheckbox: true,
							elem: ' #test1', //绑定元素
							data: [{
								title: '江西',
								children: [{
									title: '南昌',
									checked:true,
									children: [{
										title: '高新区'
									}]
								}]
							}, {
								title: '陕西',
								children: [{
									title: '西安'
								}]
							}]
						});
					},
					'json');
			});
		</script>

	</body>

</html>